<!DOCTYPE html>
<html>
  <head>
    <meta charset="UTF-8" />
    <title>菜鸟教程 React 实例</title>
    <script src="https://cdn.bootcss.com/react/15.4.2/react.min.js"></script>
    <script src="https://cdn.bootcss.com/react/15.4.2/react-dom.min.js"></script>
    <script src="https://cdn.bootcss.com/babel-standalone/6.22.1/babel.min.js"></script>
  </head>
  <body>
    <div id="example"></div>
    <script>
    var v=1;
    c=2;
    </script>
    <script type="text/babel">
      var LikeButton = React.createClass({
        getInitialState: function() {
          return {clickCount: 0};
        },
        handleClick: function(event) {
          this.setState(function(state){
            return {clickCount: state.clickCount+1}
          });
        },
        render: function() {
        var num = this.state.clickCount;
          return (
            <p onClick={this.handleClick}>
              你点了<b>{num}</b>次
            </p>
          );
        }
      });

      ReactDOM.render(
        <LikeButton />,
        document.getElementById('example')
      );
    </script>
  </body>
</html>